1. Field of the Invention
The present invention relates to a language processing system which analyzes a source file to generate an object file and, more particularly, to a language processing system which generates a debugging source file for facilitating debug of a source file.
2. Description of the Related Art
A conventional language processing system which analyzes a source file to generate an object file includes a parsing unit 801, an optimization unit 802 and a code generating unit 803 as shown in FIG. 8. The parsing unit 801 receives input of a source file 810 and conducts parsing processing of the same to generate intermediate data 820 expressed in an intermediate language. The optimization unit 802 receives input of the intermediate data 820 generated by the parsing unit 801 and conducts optimization processing of the same to generate optimized intermediate data 830. The code generating unit 803 receives input of the intermediate data 830 optimized by the optimization unit 802 and codes the same to generate an object file 840. The generated plurality of object files 840 are linked to a library to make a file of execute form, which is applied to a debugger together with the source file 810.
Possible method of optimizing the intermediate data 820 by the optimization unit 802 is disclosed, for example, in Japanese Patent Laying-Open (Kokai) No. Heisei 5-158706, entitled "Intermediate Language Optimization Processing System". The literature recites a compiler which includes an analysis means for analyzing a high-level language program to generate intermediate language data and a code generating means for generating a low-level language program from the intermediate language data, with the code generating means including an intermediate language optimization means for receiving input of an intermediate language and optimizing the same based on an intermediate language optimization program written according to intermediate language optimization writing syntax, thereby executing optimization processing at an intermediate language level independently of code generation processing.
The debugger having received the object file 840 and the source file 810 debugs optimized codes. Here, one of debug information in the object file 840 is row numbers each of which corresponds to one address. This enables execution and debug of a program on a basis of one row of the source program 810 by using the debug information in the object file 840.
With reference to FIGS. 9 to 11A and 11B, description will be here given of debug of an optimized code by a debugger. FIG. 9 shows a source program. In the figure, row numbers are assigned for convenience of explanation. FIG. 10 shows optimization image of the source program illustrated in FIG. 9. Although there are various kinds of optimization, description will be here made taking notice of development of a loop. In order to improve execution performance, optimization by reducing the number of condition determinations and branches to one-fourth is conducted to replace the source program into sequential assignment statements. FIG. 11A and 11B shows optimized intermediate data and debug information related to the source program of FIG. 9. In FIG. 11A and 11B, a part of the source program is indicated on the right side of the intermediate language. Each intermediate language signifies as follows.
XXX: label PA1 FILE: file name (debug information) PA1 LINE: row number (debug information) PA1 LDC: loading of constant PA1 STR: store into variable PA1 LOD: loading of variable PA1 LDA: loading of address of variable PA1 ADD: addition PA1 ILD: loading of data at addressed position PA1 IST: storing of data at addressed position PA1 CMP: comparison PA1 LEG: condition branch PA1 parsing means for receiving input of a source file to be processed and conducting parsing processing of the same to generate intermediate data, PA1 optimization means for receiving input of intermediate data generated by the parsing means and conducting optimization processing of the same, PA1 debugging source program information generating means for receiving input of the intermediate data optimized by the optimization means to generate a debugging source file which reflects the contents of the optimization and whose form is approximate to that of the source file based on the intermediate data, and further, adding debug information obtained in the course of the generation of the debugging source file to the optimized intermediate data, and PA1 code generating means for receiving input of the intermediate data with debug information added by the debugging source program information generating means and coding the same to generate an object file. PA1 in place of the optimization means and the debugging source program information generating means, optimization means with a debugging source program information generating function for receiving input of intermediate data generated by the parsing means and conducting optimization processing of the same, as well as generating a debugging source file which reflects the contents of optimization and whose form is approximate to that of the source file based on the optimized intermediate data, and further, adding debug information obtained in the course of the generation of the debugging source file to the optimized intermediate data. PA1 in place of the optimization means and the debugging source program information generating means, optimization means with a debugging source program information generating function for receiving input of intermediate data generated by the parsing means and conducting optimization processing of the same, as well as generating a debugging source file which reflects the contents of optimization and whose form is approximate to that of the source file based on the optimized intermediate data, and further, adding debug information obtained in the course of the generation of the debugging source file to the optimized intermediate data, wherein PA1 receiving input of a source file to be processed and conducting parsing processing of the same to generate intermediate data; PA1 receiving input of intermediate data generated at the parsing step and conducting optimization processing of the same; PA1 receiving input of the intermediate data optimized at the optimization step to generate a debugging source file which reflects the contents of optimization and whose form is approximate to that of the source file based on the intermediate data, and further, adding debug information obtained in the course of the generation of the debugging source file to the optimized intermediate data; and PA1 receiving input of the intermediate data with debug information added at the debugging source program information generating step and coding the same to generate an object file. PA1 reading one block of target blocks defined in optimization processing out of the intermediate data optimized at the optimization step, PA1 extracting source program information constituting a debugging source file from the read one block of the intermediate data, and PA1 adding debug information to the one block of the intermediate data, and wherein PA1 in place of the optimization step and the debugging source program information generating step, receiving input of intermediate data generated at the parsing step and conducting optimization processing of the same, as well as generating a debugging source file which reflects the contents of optimization and whose form is approximate to that of the source file based on the optimized intermediate data, and further, adding debug information obtained in the course of the generation of the debugging source file to the optimized intermediate data. PA1 in place of the optimization step and the debugging source program information generating step, receiving input of intermediate data generated at the parsing step and conducting optimization processing of the same, as well as generating a debugging source file which reflects the contents of optimization and whose form is approximate to that of the source file based on the optimized intermediate data, and further, adding debug information obtained in the course of the generation of the debugging source file to the optimized intermediate data, PA1 the step of optimization with a debugging source program information generating function comprising the steps of: PA1 receiving input of a source file to be processed and conducting parsing processing of the same to generate intermediate data; PA1 receiving input of intermediate data generated at the parsing step and conducting optimization processing of the same; PA1 receiving input of the intermediate data optimized at the optimization step to generate a debugging source file which reflects the contents of optimization and whose form is approximate to that of the source file based on the intermediate data, and further, adding debug information obtained in the course of the generation of the debugging source file to the optimized intermediate data; and PA1 receiving input of the intermediate data with debug information added at the debugging source program information generating step and coding the same to generate an object file.
Under the foregoing conditions, if source debug is conducted with a breakpoint set on the eighth row of FIG. 9, debug would stop at a position corresponding to the row number "8" of the debug information. In the illustrated example, however, assignment statements will be developed as shown in FIG. 10 and row numbers only exist at the end of assignment statements developed over a plurality of rows as shown in FIG. 11. One execution will therefore result in completion of four assignment statements.
As described in the foregoing, in source-level debug using an object generated by a conventional language processing system, high-level optimization processing might in some cases cause deletion and shift of codes to disable setting of a breakpoint for use in debug or cause operation in debug to incorrectly correspond to a source program to make understanding difficult. In such a case, reference to an assembler source program is required, which makes work laborious.
In addition, for generating debug information substantially correctly corresponding to a source program, there is a case where optimization processing can not be conducted. Therefore, the above-described conventional system is impractical.
Generation of an object and debug information corresponding to a source program can be realized by lowering an optimization level at the time of object generation so as not to adversely affect source-level debug or canceling optimization processing. In this case, however, since satisfactory optimization processing is not conducted, even if debug ends normally, an object file execution speed might be unsatisfactory or a code size might be increased.
Furthermore, if after debug, a desired optimization level is designated to again generate an object for the purpose of conducting satisfactory optimization processing, there is no guarantee that this execute form normally operates. This is because the possibility can not be denied that there remains a difference in operation and timing due to a difference in an object execution speed or a problem of a language processing program.